#include "Student.h"
#include <iostream>

Student::Student(string const &name,int age):age(age){
    this->name = new string(name);
}


Student::~Student()
{
    if(this->name !=nullptr){
        delete this->name;
        this->name= nullptr;
    }

    cout << "成功调用析构函数"<<endl;
}

void Student::doHomeWork(){

    cout<< *this->name << "正在做作业"<<endl;
}